/**
 * @file tal_zigbee_local_tools.h
 * @brief This is tal_zigbee_local_tools file
 * @version 1.0
 * @date 2022-06-14
 *
 * @copyright Copyright 2021-2022 Tuya Inc. All Rights Reserved.
 *
 */

#ifndef __TAL_ZIGBEE_LOCAL_INIT_H__
#define __TAL_ZIGBEE_LOCAL_INIT_H__

#include "tuya_cloud_types.h"
#include "tuya_error_code.h"
#include "tal_network_mgr.h"
#include "tal_data_receive.h"

#ifdef __cplusplus
extern "C" {
#endif

/***********************************************************************
 ********************* constant ( macro and enum ) *********************
 **********************************************************************/


/***********************************************************************
 ********************* struct ******************************************
 **********************************************************************/

typedef VOID_T (*tal_local_auto_cmd_handle_t)(TAL_ZCL_MSG_T *msg);

typedef VOID_T (*tal_zigbee_local_auto_init_fuc_t)(VOID_T);
typedef VOID_T (*local_calendar_func_t)(VOID_T);

typedef VOID_T (*tal_loacl_auto_get_pubaddress_or_timezone_func_t)(TAL_ZG_NWK_STATUS_E nwk_status);
typedef VOID_T (*tal_loacl_auto_clear_pubaddress_or_timezone_func_t)(VOID_T);

/***********************************************************************
 ********************* variable ****************************************
 **********************************************************************/

extern tal_local_auto_cmd_handle_t tal_local_auto_cmd_func;

extern tal_zigbee_local_auto_init_fuc_t tal_zigbee_local_auto_init_func;
extern tal_zigbee_local_auto_init_fuc_t tal_zigbee_local_auto_timer_func;
extern tal_zigbee_local_auto_init_fuc_t tal_zigbee_local_auto_run_func;
extern local_calendar_func_t local_calendar_run_func;

extern tal_loacl_auto_get_pubaddress_or_timezone_func_t tal_loacl_auto_get_pubaddress_func;
extern tal_loacl_auto_get_pubaddress_or_timezone_func_t tal_loacl_auto_get_timezone_func;
extern tal_loacl_auto_clear_pubaddress_or_timezone_func_t tal_loacl_auto_clear_pubaddress_func;
extern tal_loacl_auto_clear_pubaddress_or_timezone_func_t tal_loacl_auto_clear_timezone_func;

/***********************************************************************
 ********************* function ****************************************
 **********************************************************************/

VOID_T tal_zigbee_local_auto_func_enable(VOID_T);
BOOL_T tal_inner_get_local_auto_func_enable(VOID_T);

OPERATE_RET tal_broadcast_local_dp_value_func(UINT8_T num,UINT8_T *datas,UINT8_T datas_len,BOOL_T loopback,UINT16_T delay_time,UINT16_T random_time);
OPERATE_RET tal_local_auto_control_with_broadcast(UINT8_T action,UINT16_T auto_id,BOOL_T loopback,UINT16_T delay_time,UINT16_T random_time);



#ifdef __cplusplus
}
#endif

#endif /* __TFM_MESH_LOCAL_TOOLS_H__ */

